package com.kexun.servlet.teacher;

import com.alibaba.fastjson.JSON;
import com.kexun.service.TeaService;
import com.kexun.service.impl.TeaServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

@WebServlet("/findStuInfo")
public class findStuInfo extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //设置编码
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        String limitStr = request.getParameter("limit");

        String pageStr = request.getParameter("page");

        TeaService ts = new TeaServiceImpl();
        Map<String,Object> map = ts.findStudent(limitStr,pageStr);
        String s = JSON.toJSONString(map);

        if(map!=null){
            response.getWriter().print(s);
        }


    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
